package cn.zb.zbrhback;

import cn.zb.zbrhback.auth.interceptor.AuthPermInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("cn.zb.zbrhback.*.mapper")
@ServletComponentScan("cn.zb.zbrhback.auth.listener")    // 去扫描我们的监听器
public class ZbRhbackApplication implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(ZbRhbackApplication.class, args);
    }

    @Autowired
    private AuthPermInterceptor authPermInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authPermInterceptor)
                .excludePathPatterns("/login","/logout");
    }
}
